package yznu_Bean_handle;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

import Goods_Utils.Good;
import yznu_jdbc.JDpoor;

public class infoAdd {

	Connection con = new JDpoor().CreateCon();
	Statement sql = null;
	PreparedStatement pre = null;
	ResultSet rs = null;
	boolean f = false;
	

	public boolean Add_good(Good good) {
		String condition = "insert into goods_info values(?,?,?,?,?)";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, good.getName());
			pre.setString(2, good.getType());
			pre.setString(3, good.getPrice());
			pre.setString(4, good.getStock());
			pre.setString(5, good.getUrl());
	    	int t = pre.executeUpdate();
	    	if(t!=0)
	    		f = true;
	    	else
	    		f = false;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			f = false;
		}
		return f;
	}
}
